#include <iostream>
#include <set> //红黑树
#include "global.hpp"
#include <string>

struct Student
{
    int id;
    std::string name;
};


bool operator<(const Student& s1,const Student& s2)
{
    return s1.id < s2.id;
}

std::ostream &operator<<(std::ostream & os,const Student& s)
{
    os<<s.id<<" "<<s.name<<std::endl;
    return os;
}

int main()
{
    //std::less<int> 从小到大排序
    //std::greater<int> 从大到小
    // std::set<int,std::greater<int>> s;
    // s.insert(3);
    // s.insert(1);
    // s.insert(2);

    //放置自定义类型，需要重载<  要全局重载
    // std::set<Student> s;
    // s.insert({1,"zhangsan"});
    // s.insert({2,"lisi"});
    // s.insert({3,"wangwu"});

    // s.insert({1,"zhaoliu"}); //插入的元素要是唯一的
    //s.erase(3);
    // auto ite = s.find(6);
    // std::cout<<*ite<<std::endl;

    std::multiset<Student> s;
    s.insert({1,"zhangsan"});
    s.insert({2,"lisi"});
    s.insert({3,"wangwu"});

    s.insert({1,"zhaoliu"}); 
    auto ite = s.find({1,""});//只能找第一个
    std::cout<<*ite<<std::endl;
    Print(s);
    return 0;
}